<?xml version="1.0" encoding="UTF-8" standalone="no"?><HBRRepo><variables><variable id="2" name="YearVar" product="Planning" type="members" usage="const"><property name="application">HP4</property><property name="dimensionInputMode">type</property><property name="dimensionType">Year</property><property name="display_label">YearVar</property><property name="prompt_text">Select Year(s)</property><property name="scope">87654321</property><property name="seeded">true</property><value/></variable><variable id="6" name="AdjustPerc" product="Planning" type="num" usage="const"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="allowMissing">true</property><property name="prompt_text">Optional: % Increase/(Decrease)</property><property name="rule_name">OFS_BATCH TREND BASED CALCULATION</property><property name="scope">ruleset</property><property name="seeded">true</property><property name="rule">1</property><value/></variable><variable id="3" name="EntityVar" product="Planning" type="member" usage="const"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="dimension">Entity</property><property name="display_label">EntityVar</property><property name="prompt_text">Entity</property><property name="scope">87654321</property><property name="seeded">true</property><value>"OEP_Total Entity"</value></variable><variable id="1" name="ScenarioVar" product="Planning" type="member" usage="const"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="dimension">Scenario</property><property name="display_label">ScenarioVar</property><property name="prompt_text">Scenario</property><property name="scope">87654321</property><property name="seeded">true</property><value>OEP_Plan</value></variable><variable id="4" name="SelectAccount" product="Planning" type="members" usage="const"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="dimension">Account</property><property name="dimensionInputMode">name</property><property name="prompt_text">Select Account</property><property name="rule_name">OFS_BATCH TREND BASED CALCULATION</property><property name="scope">ruleset</property><property name="seeded">true</property><property name="rule">1</property><value/></variable><variable id="5" name="SelectTrend" product="Planning" type="num" usage="const"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="prompt_text">Select Trend</property><property name="rule_name">OFS_BATCH TREND BASED CALCULATION</property><property name="scope">ruleset</property><property name="seeded">true</property><property name="rule">1</property><value/><limits type="smartlist"><property name="name">OFS_Trend</property></limits></variable></variables><rulesets/><rules><rule id="1" name="OFS_Batch Trend Based Calculation" product="Planning"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="protected">false</property><property name="seeded">true</property><variable_references><variable_reference id="2" name="YearVar"><property name="application">HP4</property><property name="hidden">false</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">1</property><property name="type">4</property><property name="useAsOverrideValue">false</property><property name="validation_value">&amp;OEP_CurYr</property></variable_reference><variable_reference id="3" name="EntityVar"><property name="application">HP4</property><property name="hasvalue">true</property><property name="hidden">false</property><property name="plantype">OEP_FS</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">2</property><property name="type">3</property><property name="useAsOverrideValue">false</property><property name="validation_value">"OEP_Total Entity"</property></variable_reference><variable_reference id="1" name="ScenarioVar"><property name="application">HP4</property><property name="hasvalue">true</property><property name="hidden">false</property><property name="plantype">OEP_FS</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">3</property><property name="type">3</property><property name="useAsOverrideValue">false</property><property name="validation_value">OEP_Forecast</property></variable_reference><variable_reference id="4" name="SelectAccount"><property name="application">HP4</property><property name="hidden">false</property><property name="plantype">OEP_FS</property><property name="rule">1</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">4</property><property name="type">4</property><property name="useAsOverrideValue">false</property><property name="validation_value">"OFS_Financials Accounts"</property></variable_reference><variable_reference id="6" name="AdjustPerc"><property name="allowMissing">true</property><property name="application">HP4</property><property name="hidden">false</property><property name="plantype">OEP_FS</property><property name="rule">1</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">5</property><property name="type">1</property><property name="useAsOverrideValue">false</property></variable_reference><variable_reference id="5" name="SelectTrend"><property name="application">HP4</property><property name="hidden">false</property><property name="plantype">OEP_FS</property><property name="rule">1</property><property name="rule_name">OFS_Batch Trend Based Calculation</property><property name="seq">6</property><property name="type">1</property><property name="useAsOverrideValue">false</property></variable_reference></variable_references><script type="groovy"><![CDATA[/*RTPS:  {ScenarioVar} {YearVar} {EntityVar} {SelectAccount} {SelectTrend} {AdjustPerc} */

List<String>  years=rtps.YearVar.members.name;
List<String>  accountfix=rtps.SelectAccount.members.name;
List<String>  entity=rtps.EntityVar.members.name;
List<String>  scenario=rtps.ScenarioVar.members.name;

def trendselected=rtps.SelectTrend.enteredValue;
def scenarioselect=rtps.ScenarioVar.enteredValue;
def calcScript = new StringBuilder()
Application app=operation.getApplication();
Cube fs = operation.application.getCube("OEP_FS")
boolean weeklyPlanExists = operation.application.getDimension(DimensionType.PERIOD, fs).hasMember("OEP_Weekly Plan", fs);
def yearsDim=app.getDimension("Years", fs)
def prioryrMbrs = yearsDim.getEvaluatedMembers("""@member(@PREVSIBLING(${rtps.YearVar.toString()}))""" as String, fs)
def adjustment=rtps.AdjustPerc.enteredValue;
List<String> CustomDimensions=[];
List<String> CustomRelDimensions=[];

boolean isCurrencyApp= false
List<Dimension> dimlist=app.getDimensions(fs);
for (Dimension dim : dimlist) {
	DimensionType dType=dim.getType();
	if ((dType==DimensionType.CUSTOM && dim.name != "Plan Element")) {
		CustomRelDimensions.add('''@Relative("Total '''+dim.getName()+'''",0)''');
		CustomDimensions.add(dim.getName());
	}
	if (dType==DimensionType.CURRENCY) {
		isCurrencyApp=true;
	}
}

/*Calc Script */
calcScript<<"""
SET UPDATECALC OFF;

Fix("OEP_Working",@relative(${cscParams(entity)},0)
"""
if(CustomDimensions.size()>=1)
{
calcScript.append(CustomRelDimensions.join(''','''));
}
if (isCurrencyApp==true) {
	calcScript.append(''',@relative("Input Currencies",0)''');		
}
calcScript<<"""

,${cscParams(accountfix)})    /*relationships should be used */
"""
// selection 1
if(trendselected==("1")|| trendselected==("2"))
{
calcScript<<"""

datacopy OEP_Actual->&OEP_CurYr->OFS_Load->YearTotal to ${cscParams(scenario)}->${cscParams(years)}->"OFS_Trend"->BegBalance;
"""
}

if(trendselected==("4") || trendselected=="5")
{
calcScript<<"""

datacopy OEP_Actual->&OEP_PriorYr->OFS_Load->YearTotal to ${cscParams(scenario)}->${cscParams(years)}->"OFS_Trend"->BegBalance;
"""
}
//Forecast Only Trends 
if("OEP_Forecast" || "OEP_Rolling Forecast"){

if(trendselected==("35") || trendselected==("36")){
calcScript<<"""

datacopy OEP_Actual->&OEP_CurYr->OFS_Load->YearTotal to ${cscParams(scenario)}->${cscParams(years)}->"OFS_Trend"->BegBalance;
"""
}
if(trendselected==("3")){
calcScript<<"""
Fix(${cscParams(years)})

datacopy OEP_Plan->OFS_Calculated->YearTotal to ${cscParams(scenario)}->"OFS_Trend"->BegBalance;
endfix
"""
}
}

// select 6& 8-Plan Only Trend
if("OEP_Plan"){
if(trendselected==("6") || trendselected=="8"){

calcScript<<"""
		datacopy "OEP_Forecast"->OFS_Calculated->$prioryrMbrs->YearTotal to ${cscParams(scenario)}->OFS_Trend->${cscParams(years)}->BegBalance;		
"""
}
}

if(trendselected==("10")){
calcScript<<"""
	Fix(${cscParams(scenario)})														
		datacopy ${cscParams(prioryrMbrs)}->OFS_Calculated->YearTotal to ${cscParams(years)}->OFS_Trend->BegBalance;													
		Fix(${cscParams(years)}) 													
	            		Fix(BegBalance)												
							datacopy OFS_Trend to OFS_Calculated;	
                            datacopy OFS_Trend to "OFS_% Increase/(Decrease)";											
	            		endfix
                        Fix(OFS_Calculated,"OFS_% Increase/(Decrease)")
                        cleardata BegBalance;
                        endfix
"""
}

if(trendselected!="10")
{
calcScript<<"""
	Fix(${cscParams(scenario,years)})	
    """
    if(trendselected!="12"){
    calcScript<<"""
		Fix(BegBalance)										
			datacopy OFS_Trend to OFS_Calculated;									
			datacopy OFS_Trend to "OFS_% Increase/(Decrease)";									
		endfix										
		Fix(OFS_Calculated,"OFS_% Increase/(Decrease)")										
			cleardata BegBalance;									
		endfix										
	"""
    }
    }
    calcScript<<"""
		Fix(OFS_Trend)          										
			 BegBalance(									
			 @calcmode(block);									
			 @calcmode(bottomup);									
				 If((@sumrange(OEP_Actual->OFS_Load->&OEP_CurYr,&OEP_StartMnth:&OEP_CurMnth)+@prior(OEP_Actual->OFS_Load->YearTotal,1,@levmbrs(Years,0))								
					+"OEP_Forecast"->"OFS_Total Plan"->&OEP_FcstStartYr->YearTotal							
					+OEP_Plan->"OFS_Total Plan"->YearTotal->&OEP_CurYr)+0<>0)							
					BegBalance=$rtps.SelectTrend;							
				endif								
				)								
		Endfix	
        """
         if(adjustment!="" && adjustment!="0" )
        {
        
        calcScript<<"""
		Fix("OFS_% Increase/(Decrease)")										
			BegBalance(	
			@calcmode(block);									
			 @calcmode(bottomup);																
				If($rtps.AdjustPerc/$rtps.AdjustPerc==1)							
				if(OFS_Trend<>#missing)								
					BegBalance=$rtps.AdjustPerc;							
				endif							
			endif									
			)									
		endfix										
		"""
        }
        
         calcScript<<"""
		FIX (@remove(@relative("Period",0),@list(@relative("Financial Integration Mapping",0),"No Period")))										
												
		OFS_Calculated(										
		@calcmode(block);										
		@calcmode(bottomup);										
			if ("OFS_Trend"->"BegBalance" <> #Missing) 	
            """

if(scenarioselect=="OEP_Forecast"){
calcScript<<"""
if(@ismbr(&OEP_FCSTStartYr:&OEP_FCSTEndYr))			
	if(@ismbr(@relative("YearTotal",0)))			
		If(Not(@ismbr(&OEP_CurYr) and @ismbr(&OEP_StartMnth:&OEP_CurMnth)))		
			%Script(name:="Monthly_Trends")	
			%Script(name:="Forecast_Only_Trends")	
			endif 	
			endif	
		endif		
elseif(@ismbr(&OEP_QrtlyFcstStart:&OEP_QrtlyFcstEnd))				
         if(@ismbr(@relative("OEP_Qrtly Plan",0)))                   			
		 %Script(name:="Qrtly_Trends")		
                   		 endif		
				
elseif(@ismbr(&OEP_YrlyFcstStart:&OEP_YrlyFcstEnd))				
	if(@ismbr("OEP_Yearly Plan"))			
		%Script(name:="Yearly_Trends")		
		endif						
"""
//Forecast Weekly
if(weeklyPlanExists){
calcScript<<""" 
elseif(@ismbr(&OEP_WeeklyFCSTRange))
	if(@ismbr(@relative("OEP_Weekly Plan",0)))
    	If(Not(@ismbr(&OEP_CurYr) and @ismbr(OEP_W1:&OEP_CurWeek)))	
 			%Script(name:="Weekly_Trends")
            %Script(name:="Weekly_ForecastOnly")
            endif
            endif
     endif       
            """   
}

calcScript<<"""                 
			endif
		 endif
         )
         endfix
         endfix
         endfix
 """
 }
 

if(scenarioselect=="OEP_Plan"){
calcScript<<""" 
if (@ismbr(&OEP_PlanStartYr:&OEP_PlanEndYr))	

	if(@ismbr(@relative(YearTotal,0)))		
		%Script(name:="Monthly_Trends")	
		%Script(name:="Plan_Only_Trends")	
			
		endif /* this endif is needed for the trend */	
	endif		
			
elseif (@ismbr(&OEP_QrtlyPlanStart:&OEP_QrtlyPlanEnd))			
	If(Not(@ismbr("No Year")))		
		if (@ismbr(@relative("OEP_Qrtly Plan", 0)))	
			%Script(name:="Qrtly_Trends")
		endif	

	endif		
			
elseif (@ismbr(&OEP_YrlyPlanStart:&OEP_YrlyPlanEnd))			
    If(Not(@ismbr("No Year")))		
    if (@ismbr("OEP_Yearly Plan"))	
    %Script(name:="Yearly_Trends")
    endif
    endif	
    
    """
if(weeklyPlanExists){
calcScript<<""" 
elseif (@ismbr(&OEP_WeeklyPlanRange))
	 If(Not(@ismbr("No Year")))
			if(@ismbr(@relative("OEP_Weekly Plan",0)))
				  %Script(name:="Weekly_Trends")	
				   %Script(name:="Plan_Only_Weekly")	
				  endif
                  endif
                  endif
 """                 
}
calcScript<<"""     
endif		
endif			
		
)
endfix
endfix
endfix
"""
}

if(trendselected=="10"){
 calcScript<<"""
 endfix

 """
}

Cube cube = operation.application.getCube("OEP_FS") 
println(calcScript.toString())
cube.executeCalcScript(calcScript.toString()) ]]></script></rule></rules><components><component id="2" name="Forecast_Only_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Forecast_Only_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[elseif("OFS_Trend"->"BegBalance"==10)
				if(@isuda("Account","calcRound"))
                	IF(@ISMBR(&OEP_CurYr))
						"OFS_Calculated" = @Round(@prior("Actual"->"OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))/12*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
                    ELSE
                    	"OFS_Calculated" = @Round(@prior("OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))/12*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
                    ENDIF    
				else
                	IF(@ISMBR(&OEP_CurYr))
						"OFS_Calculated" = @prior("Actual"->"OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))/12*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
                    ELSE
                    	"OFS_Calculated" = @prior("OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))/12*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
                    ENDIF    
				endif
elseif("OFS_Trend"->"BegBalance"==3)
			if(@sumrange("OEP_Plan"->"OFS_Total Plan",&OEP_StartMnth:&OEP_EndMnth)-@sumrange("OEP_Actual"->"OFS_Load",&OEP_StartMnth:&OEP_CurMnth)>0)
				if(@ISACCTYPE(LAST))
					if(@isuda("Account","Calcround"))
						"OFS_Calculated"=@round("OEP_Plan"->"OFS_Total Plan");
					else
						"OFS_Calculated" ="OEP_Plan"->"OFS_Total Plan";
					endif
				else
					if(@isuda("Account","Calcround"))
						"OFS_Calculated"=@round(((@sumrange("OEP_Plan"->"OFS_Total Plan",&OEP_StartMnth:&OEP_EndMnth))-(@sumrange("OEP_Actual"->"OFS_Load",&OEP_StartMnth:&OEP_CurMnth)))/@count(skipnone,&OEP_FcstMnth:&OEP_EndMnth));
					else
						"OFS_Calculated"=((@sumrange("OEP_Plan"->"OFS_Total Plan",&OEP_StartMnth:&OEP_EndMnth))-(@sumrange("OEP_Actual"->"OFS_Load",&OEP_StartMnth:&OEP_CurMnth)))/@count(skipnone,&OEP_FcstMnth:&OEP_EndMnth);
					endif
				endif
			else
				"OFS_Calculated"=#missing;
			endif
    @calcmode(cell);
		elseif("OFS_Trend"->"BegBalance"==35)			
			if(@ismbr(&OEP_FCSTStartYr))
				if(@ismbr(&OEP_FcstMnth))
					if(@ismbr(@MBRCOMPARE("==", &OEP_FcstMnth, &OEP_StartMnth)))
						if(@isuda("Account","calcRound"))
							OFS_Calculated=@round((@prior("OFS_Load"->OEP_Actual->&OEP_EndMnth,1,@levmbrs(Years,0))*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
							(@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 2,@levmbrs(Years,0) )+@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 3,@levmbrs(Years,0) )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
						else
							OFS_Calculated=((@prior("OFS_Load"->OEP_Actual->&OEP_EndMnth,1,@levmbrs(Years,0))*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
  							(@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 2,@levmbrs(Years,0) )+@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 3,@levmbrs(Years,0) )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
						endif
					else
						if(@isuda("Account","calcRound"))
							OFS_Calculated=@round((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
							(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
						else
							OFS_Calculated=((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
							(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
						endif
					endif
				else
					if(@isuda("Account","calcRound"))
						OFS_Calculated=@round((@prior("OFS_Calculated")*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
                        (@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					else
						OFS_Calculated=((@prior("OFS_Calculated")*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
                        (@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					endif
				endif
			elseif(@ismbr(@RSIBLINGS(&OEP_FCSTStartYr)))
				if(@ismbr(&OEP_StartMnth))
					if(@isuda("Account","calcRound"))
						OFS_Calculated=@round((@prior("OFS_Calculated"->&OEP_EndMnth,1,@levmbrs(Years,0))*(@prior("OFS_Calculated",1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
						(@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 2,@levmbrs(Years,0) )+@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 3,@levmbrs(Years,0))))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					else
						OFS_Calculated=((@prior("OFS_Calculated"->&OEP_EndMnth,1,@levmbrs(Years,0))*(@prior("OFS_Calculated",1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
                        (@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 2,@levmbrs(Years,0) )+@prior( "OFS_Load"->OEP_Actual->&OEP_EndMnth, 3,@levmbrs(Years,0))))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					endif
				else
					if(@isuda("Account","calcRound"))
						OFS_Calculated=@round((@prior("OFS_Calculated")*(@prior("OFS_Calculated",1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
						(@MDSHIFT( "OFS_Calculated", -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					else
						OFS_Calculated=((@prior("OFS_Calculated")*(@prior("OFS_Calculated",1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
                        (@MDSHIFT( "OFS_Calculated", -1, "Period",@relative(YearTotal,0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative(YearTotal,0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
					endif
				endif
			endif
	@calcmode(block);
		elseif("OFS_Trend"->"BegBalance"==36)			
			if(@isuda("Account","calcRound"))					
		if(@ismbr(&OEP_FcstMnth) and @ismbr(&OEP_FcstStartYr))	
			"OFS_Calculated"=@round((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));			
		elseif(@ismbr(&OEP_StartMnth) and @ismbr(@RSIBLINGS(&OEP_FCSTStartYr)))
       		"OFS_Calculated"=@round((@Prior("OFS_Total Plan"->&OEP_EndMnth,1,@LEVMBRS ("Years", 0)))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
				else			
			"OFS_Calculated" =@round((@prior("OFS_Calculated")+@prior("OFS_Adjustment (+/-)"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));			
				endif	
			else		
		if(@ismbr(&OEP_FcstMnth) and @ismbr(&OEP_FcstStartYr))	
			"OFS_Calculated"=@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");			
		elseif(@ismbr(&OEP_StartMnth) and @ismbr(@RSIBLINGS(&OEP_FCSTStartYr)))
        	"OFS_Calculated"=@Prior("OFS_Total Plan"->&OEP_EndMnth,1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
				else
			"OFS_Calculated" =(@prior("OFS_Calculated")+@prior("OFS_Adjustment (+/-)"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");			
				endif	
			endif]]></script></component><component id="1" name="Monthly_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Monthly_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[If("OFS_Trend"->"BegBalance"==1)						
	if(@isuda("Account","CalcRound"))					
		OFS_Calculated = @Round(@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		OFS_Calculated =@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->"BegBalance"==2)						
	if(@isuda("Account","CalcRound"))					
		OFS_Calculated =@Round(("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load")*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		OFS_Calculated = ("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load")*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
						
elseif("OFS_Trend"->"BegBalance"==4)						
	if(@isuda("Account","CalcRound"))					
		OFS_Calculated = @Round(@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		OFS_Calculated = @avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->"BegBalance"==5)						
	if(@isuda("Account","CalcRound"))					
		OFS_Calculated = @Round(("OEP_Actual"->"OFS_Load"->&OEP_PriorYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		OFS_Calculated = ("OEP_Actual"->"OFS_Load"->&OEP_PriorYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->BegBalance==12)						
	OFS_Calculated =#missing;					
elseif("OFS_Trend"->BegBalance==#missing and "OFS_Adjustment (+/-)"<>#missing)										
	OFS_Calculated=0;
    OFS_Calculated=#missing;					
					
]]></script></component><component id="7" name="Plan_Only_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Plan_Only_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[elseif("OFS_Trend"->"BegBalance"==6)
			if(@isuda("Account","CalcRound"))
				"OFS_Calculated" = @Round(@avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),@relative("YearTotal",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
			else
				"OFS_Calculated" = @avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),@relative("YearTotal",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
	endif                
	                
elseif("OFS_Trend"->"BegBalance"==8)
			if(@isuda("Account","CalcRound"))
				"OFS_Calculated" = @Round(@prior("OEP_Forecast"->"OFS_Total Plan",1, @LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
			else
				"OFS_Calculated" = @prior("OEP_Forecast"->"OFS_Total Plan",1, @LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
			endif
elseif("OFS_Trend"->"BegBalance"==10)
				if(@isuda("Account","calcRound"))
					"OFS_Calculated" = @Round(@prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
				else
					"OFS_Calculated" = @prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
	endif]]></script></component><component id="8" name="Plan_Only_Weekly" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Plan_Only_Weekly</property><property name="seeded">true</property><script type="calcscript"><![CDATA[elseif("OFS_Trend"->"BegBalance"==6)
			if(@prior("TP-Weeks",1,@levmbrs(Years,0))==52)
				if(@isuda("Account","CalcRound"))
					"OFS_Calculated" = @Round(@avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),OEP_W1:OEP_W52)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
				else
					"OFS_Calculated" = @avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),OEP_W1:OEP_W52)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
				endif        
			else
				if(@isuda("Account","CalcRound"))
					"OFS_Calculated" = @Round(@avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),@relative("OEP_Weekly Plan",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
				else
					"OFS_Calculated" = @avgrange(skipnone,"OEP_Forecast"->"OFS_Total Plan"->@member(@prevsibling(@currmbr(Years))),@relative("OEP_Weekly Plan",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
				endif   
			 endif
elseif("OFS_Trend"->"BegBalance"==8)	
			if(@isuda("Account","CalcRound"))
				"OFS_Calculated" = @Round(@prior("OEP_Forecast"->"OFS_Total Plan",1, @LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
			else
				"OFS_Calculated" = @prior("OEP_Forecast"->"OFS_Total Plan",1, @LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
			endif
elseif("OFS_Trend"->"BegBalance"==10)
			if(@isuda("Account","calcRound"))
				"OFS_Calculated" = @Round(@prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
			else
				"OFS_Calculated" = @prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
			endif]]></script></component><component id="3" name="Qrtly_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Qrtly_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[If("OFS_Trend"->"BegBalance"==1)										
		if(@isuda("Account","CalcRound"))	
        	if(@isuda("Account","Flow"))
				"OFS_Calculated" = @Round((@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth))*"PeriodsInQtr"*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
            else
            	"OFS_Calculated" = @Round((@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
            endif
		else
        	if(@isuda("Account","Flow"))
				OFS_Calculated =(@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth))*"PeriodsInQtr"*(1+"OFS_% Increase/(Decrease)"->"BegBalance");			
            else
            	OFS_Calculated =(@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , &OEP_StartMnth:&OEP_CurMnth))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");		
            endif
		endif									
elseif("OFS_Trend"->"BegBalance"==2)										
		if(@isuda("Account","CalcRound"))
        	if(@isuda("Account","Flow"))
				OFS_Calculated =@Round((("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load")*"PeriodsInQtr")*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));	
            else
            	OFS_Calculated =@Round((("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));	
            endif
		else	
        	if(@isuda("Account","Flow"))
				OFS_Calculated = (("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load")*"PeriodsInQtr")*(1+"OFS_% Increase/(Decrease)"->"BegBalance");	
            else
            	OFS_Calculated = (("OEP_Actual"->&OEP_CurMnth->&OEP_CurYr->"OFS_Load"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");	
            endif
		endif									
	elseif("OFS_Trend"->"BegBalance"==4)										
		if(@isuda("Account","CalcRound"))		
        	if(@isuda("Account","Flow"))
				OFS_Calculated = @Round((@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0))*"PeriodsInQtr")*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));		
            else
           		OFS_Calculated = @Round((@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0)))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));	
            endif
		else	
        	if(@isuda("Account","Flow"))
				OFS_Calculated = (@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0))*"PeriodsInQtr")*(1+"OFS_% Increase/(Decrease)"->"BegBalance");	
            else
            	OFS_Calculated = (@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("YearTotal",0)))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
            endif
		endif												
	elseif("OFS_Trend"->"BegBalance"==10)										
		if(@prior("OEP_Qrtly Plan",1,@levmbrs("Years",0))<>#Missing)									
			if(@isuda("Account","CalcRound"))								
				@Round(@Prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));							
			else								
				@Prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");							
			endif								
		else									
			if(@isuda("Account","CalcRound"))								
				if(@ismbr("Qtrly 1"))							
					@Round(@Prior("OFS_Total Plan"->"Q1",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));						
				elseif(@ismbr("Qtrly 2"))							
					@Round(@Prior("OFS_Total Plan"->"Q2",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));						
				elseif(@ismbr("Qtrly 3"))							
					@Round(@Prior("OFS_Total Plan"->"Q3",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));						
				elseif(@ismbr("Qtrly 4"))							
					@Round(@Prior("OFS_Total Plan"->"Q4",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));						
				endif							
			else								
				if(@ismbr("Qtrly 1"))							
					@Prior("OFS_Total Plan"->"Q1",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");						
				elseif(@ismbr("Qtrly 2"))							
					@Prior("OFS_Total Plan"->"Q2",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");						
				elseif(@ismbr("Qtrly 3"))							
					@Prior("OFS_Total Plan"->"Q3",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");						
				elseif(@ismbr("Qtrly 4"))							
					@Prior("OFS_Total Plan"->"Q4",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");						
				endif							
			endif								
											
		endif									
	elseif("OFS_Trend"->BegBalance==12)										
				OFS_Calculated=#missing;							
	elseif("OFS_Trend"->BegBalance==#missing and "OFS_Adjustment (+/-)"<>#missing)																
				OFS_Calculated=0;
                OFS_Calculated=#missing;							
	endif										

]]></script></component><component id="6" name="Weekly_ForecastOnly" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Weekly_ForecastOnly</property><property name="seeded">true</property><script type="calcscript"><![CDATA[elseif("OFS_Trend"->"BegBalance"==3)						
	if(("OEP_Plan"->"OFS_Total Plan"->"OEP_Weekly Plan")-@sumrange("OEP_Actual"->"OFS_Load",OEP_W1:&OEP_CurWeek)>0)							
          if(@ISACCTYPE(LAST))				
              if(@isuda("Account","Calcround"))			
                  "OFS_Calculated"=@round("OEP_Plan"->"OFS_Total Plan");		
              else			
                  "OFS_Calculated" ="OEP_Plan"->"OFS_Total Plan";		
              endif			
          else				
              	if(@isuda("Account","Calcround"))		
				"OFS_Calculated"=@round((("OEP_Plan"->"OFS_Total Plan"->"OEP_Weekly Plan")-@sumrange("OEP_Actual"->"OFS_Load",OEP_W1:&OEP_CurWeek))/("TP-Weeks"-@count(skipnone,@range("OFS_Load",OEP_W1:&OEP_CurWeek))));				
                  else
				"OFS_Calculated"=((("OEP_Plan"->"OFS_Total Plan"->"OEP_Weekly Plan")-@sumrange("OEP_Actual"->"OFS_Load",OEP_W1:&OEP_CurWeek))/("TP-Weeks"-@count(skipnone,@range("OFS_Direct Input",OEP_W1:&OEP_CurWeek))));				
              endif			
          endif				
      else					
          "OFS_Calculated"=#missing;				
      endif	
elseif("OFS_Trend"->"BegBalance"==35)			
  	if(@isuda("Account","calcRound"))		  			
  		if(@ismbr(&OEP_FcstMnth))	
			"OFS_Calculated"=@round((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
			(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));					
  		else
			"OFS_Calculated" =@round((@prior("OFS_Calculated")*					
  			(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
			(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));					
  		endif	
  	else		
  		if(@ismbr(&OEP_FcstMnth))	
			"OFS_Calculated"=((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/					
			(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));					
  	 	else	 			
			"OFS_Calculated" =((@prior("OFS_Calculated")*					
  			(@prior("OFS_Load"->OEP_Actual,1,@LEVMBRS ("Years", 0))+@prior("OFS_Load"->OEP_Actual,2,@LEVMBRS ("Years", 0)))/
			(@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -1, "Years", )+@MDSHIFT( "OFS_Load"->OEP_Actual, -1, "Period",@relative("OEP_Weekly Plan",0) , -2, "Years", )))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));  					
  		endif	
  	endif	
elseif("OFS_Trend"->"BegBalance"==36)			
	if(@isuda("Account","calcRound"))					
		if(Not(@ismbr(OEP_W1:&OEP_CurWeek) and @ismbr(&OEP_CurYr)))	
			"OFS_Calculated"=@round((@prior("OFS_Load"->OEP_Actual->&OEP_CurYr))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));			
		elseif(@ismbr(OEP_W1) and @ismbr(@RSIBLINGS(&OEP_CurYr)))
       		"OFS_Calculated"=@round((@Prior("OFS_Total Plan"->OEP_W52,1,@LEVMBRS ("Years", 0)))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));
        else			
			"OFS_Calculated" =@round((@prior("OFS_Calculated")+@prior("OFS_Adjustment (+/-)"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));			
		endif	
	else		
		if(Not(@ismbr(OEP_W1:&OEP_CurWeek) and @ismbr(&OEP_CurYr)))	
			"OFS_Calculated"=@prior("OFS_Load"->OEP_Actual->&OEP_CurYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");			
		elseif(@ismbr(OEP_W1) and @ismbr(@RSIBLINGS(&OEP_CurYr)))
        	"OFS_Calculated"=@Prior("OFS_Total Plan"->OEP_W52,1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");
        else
			"OFS_Calculated" =(@prior("OFS_Calculated")+@prior("OFS_Adjustment (+/-)"))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");			
		endif	
	endif           ]]></script></component><component id="5" name="Weekly_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Weekly_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[If("OFS_Trend"->"BegBalance"==1)						
	if(@isuda("Account","CalcRound"))					
		"OFS_Calculated"=@Round(@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , OEP_W1:&OEP_CurWeek)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		"OFS_Calculated"=@AVGRANGE(SKIPNONE , "OEP_Actual"->"OFS_Load"->&OEP_CurYr , OEP_W1:&OEP_CurWeek)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->"BegBalance"==2)						
	if(@isuda("Account","CalcRound"))					
		"OFS_Calculated"=@Round(("OEP_Actual"->&OEP_CurWeek->&OEP_CurYr->"OFS_Load")*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		"OFS_Calculated"=("OEP_Actual"->&OEP_CurWeek->&OEP_CurYr->"OFS_Load")*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->"BegBalance"==4)
	if("TP-Weeks"->&OEP_PriorYr==52)        
		if(@isuda("Account","CalcRound"))	 		  
			"OFS_Calculated"= @Round(@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,OEP_W1:OEP_W52)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
		else					
			"OFS_Calculated"= @avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,OEP_W1:OEP_W52)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
		endif
	else       
		if(@isuda("Account","CalcRound"))	 		  
			"OFS_Calculated"= @Round(@avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("OEP_Weekly Plan",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
		else					
			"OFS_Calculated"= @avgrange(skipnone,"OEP_Actual"->"OFS_Load"->&OEP_PriorYr,@relative("OEP_Weekly Plan",0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
		endif
	endif
elseif("OFS_Trend"->"BegBalance"==5)						
	if(@isuda("Account","CalcRound"))					
		"OFS_Calculated"= @Round(("OEP_Actual"->"OFS_Load"->&OEP_PriorYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
	else					
		"OFS_Calculated"= ("OEP_Actual"->"OFS_Load"->&OEP_PriorYr)*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
	endif					
elseif("OFS_Trend"->BegBalance==12)						
	"OFS_Calculated"=#missing;					
elseif("OFS_Trend"->BegBalance==#missing and "OFS_Adjustment (+/-)"<>#missing)										
	OFS_Calculated=0;
    OFS_Calculated=#missing;					]]></script></component><component id="4" name="Yearly_Trends" product="Planning" type="script"><property name="application">HP4</property><property name="plantype">OEP_FS</property><property name="display_label">Yearly_Trends</property><property name="seeded">true</property><script type="calcscript"><![CDATA[if("OFS_Trend"->"BegBalance"==10)							
	if(@prior("OEP_Yearly Plan"->"OFS_Total Plan",1,@levmbrs("Years",0))<>#Missing)						
		if(@isuda("Account","CalcRound"))					
			OFS_Calculated=@Round(@Prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
		else					
			OFS_Calculated=@Prior("OFS_Total Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
		endif					
	elseif(@prior("OEP_Qrtly Plan"->"OFS_Total Plan",1,@levmbrs("Years",0))<>#Missing)						
		if(@isuda("Account","CalcRound"))					
			OFS_Calculated=@Round(@Prior("OFS_Total Plan"->"Qrtly Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
		else					
			OFS_Calculated=@Prior("OFS_Total Plan"->"Qrtly Plan",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
		endif					
	elseif(@prior("YearTotal"->"OFS_Total Plan",1,@levmbrs("Years",0))<>#Missing)						
		if(@isuda("Account","CalcRound"))					
			OFS_Calculated=@Round(@Prior("OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance"));				
		else					
			OFS_Calculated=@Prior("OFS_Total Plan"->"YearTotal",1,@LEVMBRS ("Years", 0))*(1+"OFS_% Increase/(Decrease)"->"BegBalance");				
		endif					
	endif						
							
elseif("OFS_Trend"->BegBalance==12)							
			OFS_Calculated=#missing;				
elseif("OFS_Trend"->BegBalance==#missing and "OFS_Adjustment (+/-)"<>#missing)	
			OFS_Calculated=0;
			OFS_Calculated=#missing;				
endif							


]]></script></component></components><deployobjects><deployobject application="hp4" name="OFS_BATCH TREND BASED CALCULATION" obj_id="1" obj_type="1" plantype="oep_fs" product="2"/></deployobjects></HBRRepo>